package cn.weekdragon.gscore.adapter.service;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

public class ServiceManager {

    private static final Map<String,Service> NAME_MAP = new HashMap<>();

    public static Optional<Service> getService(String serviceName){
        return Optional.ofNullable(NAME_MAP.get(serviceName));
    }


    public static void addService(Service service){
        NAME_MAP.put(service.getServiceName(),service);
    }

    public static Collection<Service> getServices() {
        return NAME_MAP.values();
    }
}
